#include "StandardException.h"
#include <cstring>

namespace core {
    namespace exceptions {

        using namespace std;

        StandardException::StandardException() {
        }

        StandardException::~StandardException() {
        }

        StandardException::StandardException(STANDARD_EXCEPTIONS code, std::string location) {
            excCode = code;
            this->location = location;
        }

        const char* StandardException::what() const throw () {
            std::string retStr = ExceptionStrings[excCode] + " " + location;
            char* ret = new char[retStr.length() + 1];
            strcpy(ret, retStr.c_str());
            return ret;
        }

        string StandardException::handleException() {
            const char* err = this->what();
            std::string ret(err);
            delete err;
            return ret;
        }
        
    }
}